import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import {
  PurchaseEnterWarehouseOrderVO,
  PurchaseEnterWarehouseOrderForm,
  PurchaseEnterWarehouseOrderQuery
} from '@/api/datacheck/jd/purchaseEnterWarehouseOrder/types';

/**
 * 查询金蝶-采购入库单列表
 * @param query
 * @returns {*}
 */

export const listPurchaseEnterWarehouseOrder = (query?: PurchaseEnterWarehouseOrderQuery): AxiosPromise<PurchaseEnterWarehouseOrderVO[]> => {
  return request({
    url: '/dataCheck/jd/purchaseEnterWarehouseOrder/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询金蝶-采购入库单详细
 * @param id
 */
export const getPurchaseEnterWarehouseOrder = (id: string | number): AxiosPromise<PurchaseEnterWarehouseOrderVO> => {
  return request({
    url: '/dataCheck/jd/purchaseEnterWarehouseOrder/' + id,
    method: 'get'
  });
};

/**
 * 新增金蝶-采购入库单
 * @param data
 */
export const addPurchaseEnterWarehouseOrder = (data: PurchaseEnterWarehouseOrderForm) => {
  return request({
    url: '/dataCheck/jd/purchaseEnterWarehouseOrder',
    method: 'post',
    data: data
  });
};

/**
 * 修改金蝶-采购入库单
 * @param data
 */
export const updatePurchaseEnterWarehouseOrder = (data: PurchaseEnterWarehouseOrderForm) => {
  return request({
    url: '/dataCheck/jd/purchaseEnterWarehouseOrder',
    method: 'put',
    data: data
  });
};

/**
 * 删除金蝶-采购入库单
 * @param id
 */
export const delPurchaseEnterWarehouseOrder = (id: string | number | Array<string | number>) => {
  return request({
    url: '/dataCheck/jd/purchaseEnterWarehouseOrder/' + id,
    method: 'delete'
  });
};
